package com.thinvent.recommend.common.enums;

public enum FileExtensionEnums {

    TXT("txt"),
//    DOC("doc"), TODO 增加doc其他的解析方式
    DOCX("docx"),
    XLS("xls"),
    XLSX("xlsx"),
    PPT("ppt"),
    PPTX("pptx"),
    PDF("pdf");

    private final String extension;

    FileExtensionEnums(String extension) {
        this.extension = extension;
    }

    public String getExtension() {
        return extension;
    }

    @Override
    public String toString() {
        return extension;
    }

    // 根据字符串获取枚举值
    public static FileExtensionEnums fromString(String value) {
        for (FileExtensionEnums ext : FileExtensionEnums.values()) {
            if (ext.getExtension().equalsIgnoreCase(value)) {
                return ext;
            }
        }
        throw new IllegalArgumentException("No enum constant for extension: " + value);
    }

}
